package com.jk.thread;

import com.sun.org.apache.bcel.internal.generic.NEW;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class SafeThread {
    public static void main(String[] args) {
        List<Integer> numberList = new ArrayList<>();
        for (int i = 0; i < 10000; i++) {
            new Thread(new Runnable() {
                @Override
                public void run() {

                    numberList.add(1);
                }
            }).start();
        }
        try {
                Thread.sleep(5000);
        }catch(InterruptedException e){
                e.printStackTrace();
        }
        System.out.println("args = " + numberList.size());
    }
}
